/**
 *
 * Copyright by Samuel Castro & Joaquim Fonseca, 2011
 * All Rights Reserved
 *
 * NOTES:
 * Please do not redistribute this plugin without my permission
 * Plugin made for private use only
 *
 */
package com.SySammy.sdQuests.Handlers;

import java.io.File;
import org.bukkit.util.config.Configuration;

public class InheritanceHandler {

    private static final File RegQuestFile = new File("plugins/RPGmod/Quests/FinishedQuests.yml");

    public Configuration load() {
        try {
            Configuration PluginPropConfig = new Configuration(RegQuestFile);
            PluginPropConfig.load();
            return PluginPropConfig;

        } catch (Exception e) {
        }
        return null;
    }

    public void saveQuestPart(String p, String quest) {
        Configuration config = load();
        String root = "quests." + quest + ".part";
        int part = loadQuestPart(p, quest) + 1;
        config.setProperty(root, part);
        config.save();
    }

    public int loadQuestPart(String p, String quest) {
        Configuration config = load();
        String root = "quests." + quest + ".part";
        return config.getInt(root, 1);
    }
}
